<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.domain.ZhongLei,java.util.ArrayList,com.domain.*"%>

<%
YongHu yonghu=(YongHu)session.getAttribute("yonghu");			
ArrayList<ShangPin> gouwuche=(ArrayList<ShangPin>)session.getAttribute("gouwuche");
if(yonghu==null || gouwuche==null)
{
	request.getRequestDispatcher("yonghudenglu.jsp").forward(request, response);

}
%>

<html>
  <head>
	  <style>A{text-decoration: NONE} </style>
	  <title>结算</title>
  </head>
  <body bgcolor="#d0eed8">

<%
	if(gouwuche.size()==0)
	{
%>
	<p align="center">购物车为空，请先添加商品
	<p align="center"><a href="Shangchengshouye">确定</a>&nbsp;&nbsp;<a href="gerenzhongxin.jsp">返回</a>
<%
	}
	else
	{
		float zongjine=0;
		ShangPin shangpin;
		int i;
		for(i=0;i<gouwuche.size();i++ )
		{
			shangpin=gouwuche.get(i);
			if(shangpin.getTupian().size()==0)
			{
%>
					<p align="center">存在失效商品，请先删除
					<p align="center"><a href="gerenzhongxin.jsp">确定</a>
<%				
				break;			
			}
			else
			{
				zongjine+=shangpin.getJiage()*shangpin.getShuliang();
			}
		}
		if(i==gouwuche.size())
		{
%>		
			<p align="center">总金额：<%=zongjine %>
			<p align="center"><a href="Jiesuan">确定</a>&nbsp;&nbsp;<a href="gerenzhongxin.jsp">取消</a>
<%			
		}		
	}
%>
  </body>
</html>
